# ===============================================================#
#                     Replication files for:                     #
#.  "Attitudinal and Behavioral Legacies of Wartime Violence:    #
#                      A Meta-Analysis"                          #
#                        Joan Barceló                            #
#               American Political Science Review                #
#               Last update: September 3, 2025                   #
# ===============================================================#

#################################
# Figure E.1: Number of studies (including only excluded studies) by publication year
################################

library(ggplot2)
library(haven)

#Load dataset
PATH <- ""
pop_studies <- haven::read_dta(paste0(PATH, "include_studies.dta"))

pop_not_included <- subset(pop_studies, included == 0)

Figure_E1 <- ggplot(pop_not_included, aes(x = as.numeric(PublicationYear))) +
  geom_histogram(binwidth = 1, fill = "grey70", color = "black") +
  labs(x = "Publication Year",
       y = "Number of studies",
       title = "") +
  theme_minimal() +
  theme(axis.text.x = element_text(angle = 45, hjust = 1, size = 14),
        axis.text.y = element_text(size = 14),
        axis.title = element_text(size = 16, margin = margin(t = 15)))

print(Figure_E1)

ggsave(filename = "/Users/jbs548/Library/CloudStorage/Dropbox/Joan Barcelo/Present/NYUAD Assistant Professor/Research/Papers/Work in Progress/Meta_analysis/Analysis/Results/Figures/Descriptive/hist_nonincluded_year.pdf",
       plot = Figure_E1, width = 12, height = 8)
